package com.aynu.webshop.web.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.aynu.webshop.core.generic.GenericDao;
import com.aynu.webshop.core.generic.GenericServiceImpl;
import com.aynu.webshop.web.dao.AddressMapper;
import com.aynu.webshop.web.model.Address;
import com.aynu.webshop.web.service.AddressService;

@Service
public class AddressServiceImpl extends GenericServiceImpl<Address, Integer> implements AddressService {

	@Resource
	private AddressMapper addressMapper;
	
	@Override
	public int insert(Address model) {
		// TODO Auto-generated method stub
		return addressMapper.insertSelective(model);
	}

	@Override
	public int update(Address model) {
		// TODO Auto-generated method stub
		return addressMapper.updateByPrimaryKeySelective(model);
	}

	@Override
	public int delete(Integer id) {
		// TODO Auto-generated method stub
		return addressMapper.deleteByPrimaryKey(id);
	}

	@Override
	public Address selectById(Integer id) {
		// TODO Auto-generated method stub
		return addressMapper.selectByPrimaryKey(id);
	}

	@Override
	public Address selectOne() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<Address> selectList() {
		// TODO Auto-generated method stub
		return addressMapper.findAll();
	}

	@Override
	public GenericDao<Address, Integer> getDao() {
		// TODO Auto-generated method stub
		return addressMapper;
	}

	@Override
	public List<Address> selectListByUid(Integer uid) {
		// TODO Auto-generated method stub
		return addressMapper.findAllByUid(uid);
	}

}
